import { resolve } from 'path'
import Bundler from 'parcel-bundler'
import koaStatic from 'koa-static'

const r = path => resolve(__dirname, path)

const bundler = new Bundler(r('../../../src/index.html'), {
  publicUrl: '/',
  watch: true
})

export const func = async app => {
  await bundler.bundle()

  app.use(koaStatic(r('../../../dist')))

}